<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // String()   强制转化为字符串
        // Number()   强制转化为数字
        // Boolean()  强制转布尔值

        var a = 1 ;
        var b = String(a) ;
        console.log(b);   // '1'


        console.log(Number('hello'));   // NaN

        console.log(Boolean('hello'));   // true



        // 求和
        var m = 1 ;
        var n = '2' ;

        // 强制转化
        var result = m + Number(n) ;

        // 隐式转化
        var result = m + n * 1 ;

        var result = m + n / 1 ;

        var result = m + (n - 0) ;

    </script>
    
</body>
</html>